import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

public class TestAPI {
    public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create ();
        conf.set ("hbase.zookeeper.quorum","master:2181,node1:2181,node2:2181");
        Connection conn = ConnectionFactory.createConnection (conf);
        Admin admin = conn.getAdmin ( );
        HTableDescriptor testAPI = new HTableDescriptor (TableName.valueOf ("testAPI"));
        HColumnDescriptor bajie = new HColumnDescriptor ("bajie");
        bajie.setMaxVersions (3);
        testAPI.addFamily (bajie);
        admin.createTable (testAPI);
        admin.close ();
        conn.close ();


    }
}
